package com.jeecg.p3.commonluckymoney.service.impl;

import com.jeecg.p3.commonluckymoney.dao.WxActCommonluckymoneyRegistrationDao;
import com.jeecg.p3.commonluckymoney.entity.WxActCommonluckymoneyRegistration;
import com.jeecg.p3.commonluckymoney.service.WxActCommonluckymoneyRegistrationService;
import org.jeecgframework.p3.core.utils.common.PageList;
import org.jeecgframework.p3.core.utils.common.PageQuery;
import org.jeecgframework.p3.core.utils.common.PageQueryWrapper;
import org.jeecgframework.p3.core.utils.common.Pagenation;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("wxActCommonluckymoneyRegistrationService")
public class WxActCommonluckymoneyRegistrationServiceImpl implements WxActCommonluckymoneyRegistrationService {
	@Resource
	private WxActCommonluckymoneyRegistrationDao wxActCommonluckymoneyRegistrationDao;

	@Override
	public void doAdd(WxActCommonluckymoneyRegistration wxActCommonluckymoneyRegistration) {
		wxActCommonluckymoneyRegistrationDao.insert(wxActCommonluckymoneyRegistration);
	}

	@Override
	public void doEdit(WxActCommonluckymoneyRegistration wxActCommonluckymoneyRegistration) {
		wxActCommonluckymoneyRegistrationDao.update(wxActCommonluckymoneyRegistration);
	}

	@Override
	public void doDelete(String id) {
		wxActCommonluckymoneyRegistrationDao.delete(id);
	}

	@Override
	public WxActCommonluckymoneyRegistration queryById(String id) {
		WxActCommonluckymoneyRegistration wxActCommonluckymoneyRegistration  = wxActCommonluckymoneyRegistrationDao.get(id);
		return wxActCommonluckymoneyRegistration;
	}

	@Override
	public PageList<WxActCommonluckymoneyRegistration> queryPageList(
		PageQuery<WxActCommonluckymoneyRegistration> pageQuery) {
		PageList<WxActCommonluckymoneyRegistration> result = new PageList<WxActCommonluckymoneyRegistration>();
		Integer itemCount = wxActCommonluckymoneyRegistrationDao.count(pageQuery);
		PageQueryWrapper<WxActCommonluckymoneyRegistration> wrapper = new PageQueryWrapper<>(pageQuery.getPageNo(), pageQuery.getPageSize(),itemCount, pageQuery.getQuery());
		List<WxActCommonluckymoneyRegistration> list = wxActCommonluckymoneyRegistrationDao.queryPageList(wrapper);
		Pagenation pagenation = new Pagenation(pageQuery.getPageNo(), itemCount, pageQuery.getPageSize());
		result.setPagenation(pagenation);
		result.setValues(list);
		return result;
	}

	@Override
	public WxActCommonluckymoneyRegistration queryRegistrationByActIdAndOpenid(
			String actId, String openid) {
		// TODO Auto-generated method stub
		return wxActCommonluckymoneyRegistrationDao.queryRegistrationByActIdAndOpenid(actId, openid);
	}
	
}
